﻿using System;
using System.Collections.Generic;

namespace Program26
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入用户名");
            var name = Console.ReadLine();
            Console.WriteLine("请输入密码");
            var pwd = Console.ReadLine();
            var msg = "";
            var statu = Login(name, pwd, out msg);
            Console.WriteLine("登录结果{0},提醒{1}", statu, msg);
        }
        public static bool Login(string name, string pwd, out string statusMessage)
        {
            statusMessage = "登录失败";

            if (string.IsNullOrEmpty(name))
            {
                statusMessage = "用户名不能为空";
                return false;
            }
            if (string.IsNullOrEmpty(name))
            {
                statusMessage = "密码不能为空";
                return false;
            }

            //检查是否存在此用户
            var users = new List<string>();
            users.Add("歪比歪比");
            if (!users.Contains(name))
            {
                statusMessage = "此用户不存在,请重试";
                return false;
            }

            //检查口令是否正确
            if (name == "歪比歪比" && pwd == "歪比巴布")
            {
                statusMessage = "登录成功,请尽情娱乐";
                return true;
            }
            else
            {
                statusMessage = "登录失败,请重试";
                return false;
            }
        }
    }
}